package com.control.qct.businesssteward.adapter;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.model.EverydayAccountModel;
import com.control.qct.businesssteward.utils.DecimalFormatUtils;

import java.util.List;
import java.util.Random;

/**
 * Created by Administrator on 2018/3/27 0027.
 */

public class PayItemsAdapter extends BaseQuickAdapter<EverydayAccountModel.PayitemsBean, BaseViewHolder> {
    private String[] colorList = {"#FEB64B", "#62D84B", "#5598DF", "#5899FE", "#FF7A64", "#FF5E87"};

    public PayItemsAdapter(@Nullable List<EverydayAccountModel.PayitemsBean> data) {
        super(R.layout.rv_pay_items_item, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, EverydayAccountModel.PayitemsBean item) {
        int i = new Random().nextInt(colorList.length);
        holder.setBackgroundColor(R.id.v_tag, Color.parseColor(colorList[i])).setText(R.id.tv_pay_name, item.getTitle())
                .setText(R.id.tv_cash, DecimalFormatUtils.DecimalFormatTwo(item.getMoney()));

    }
}
